<style>
    .update-address-html .order-map{width:876px;height:380px}
</style>
<!-- 管理员审核下单模态 -->
<script type="text/html" id="review_html">
    <div class="layui-form" id='review' lay-filter="review">
        <input type="hidden" name="order_goods_id" value="{{ d.order_goods_id }}"/>
        <div class="layui-form-item">
            <label class="layui-form-label">审核</label>
            <div class="layui-input-block">
                <input type="radio" name="review" value="1" title="通过" checked>
                <input type="radio" name="review" value="0" title="拒绝">
            </div>
        </div>
        <button class="layui-btn" lay-submit id="submit" lay-filter="submit" style="display:none;">保存</button>
    </div>
</script>
<script>
    var form;
    /**
     * 已下单审核
     */
    function review(order_goods_id) {
        console.log(order_goods_id);
        //获取模板
        var getTpl = $("#review_html").html();
        laytpl(getTpl).render({order_goods_id: order_goods_id}, function(html) {
            layer.open({
                type: 1,
                shadeClose: true,
                shade: 0.3,
                offset: 'auto',
                scrollbar: true,
                fixed: false,
                title: "下单审核",
                area: ['500px'],
                btn: ['确定', '取消'],
                yes: function(index, layero){
                    $("#submit").click();
                },
                btn2: function(index, layero){
                    layer.close(index);
                },
                content:  html,
                cancel: function(){},
                success: function(layero, index){
                    form.on('submit(submit)', function(data){
                        if(data.field.review == ''){
                            layer.msg('请选择选择审核结果', {icon: 5, anim: 6});
                            return;
                        }
                        if(repeat_flag)return;
                        repeat_flag = true;
                        $.ajax({
                            url: ns.url("shop/order/review"),
                            type: "POST",
                            dataType: "JSON",
                            async: false,
                            data: data.field,
                            success: function (res) {
                                layer.msg(res.msg);
                                if(res.code == 0){
                                    setTimeout(function () {
                                        layer.closeAll();
                                        location.reload();
                                    }, 1500);
                                }else{
                                    repeat_flag = false;
                                }
                            }
                        });
                        return false;
                    });
                }
            });
            form.render();
        });
    }
</script>